﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Client
{
    public partial class Form1 : Form
    {
        WS.ServiceClient cl = null;
        MyCallback cb = null;

        public Form1()
        {
            InitializeComponent();
            cb = new MyCallback();
            cb.ValueCallbacked += new EventHandler<MyEvenArgs>(cb_ValueCallbacked);
        }

        void cb_ValueCallbacked(object sender, MyEvenArgs e)
        {
            this.label1.Text = e.N.ToString();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            cl = new WS.ServiceClient(new System.ServiceModel.InstanceContext(cb));
            cl.CallServerOp();
            button1.Enabled = false;
            button2.Enabled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            cl.End();
            button1.Enabled = true;
            button2.Enabled = false;
        }
    }

    

}
